package com.mt.api.modules.controller;

import com.mt.api.modules.domain.bo.BossSetupBo;
import com.mt.api.modules.service.AppBossSetupService;
import com.mt.api.util.ParamsValid;
import com.mt.common.response.WebResponse;
import com.mt.common.response.WebResponseUtils;
import lombok.RequiredArgsConstructor;
import com.mt.log.annotation.Log;
import org.springframework.web.bind.annotation.*;


/**
 * @author plover
 * @date 2020-07-06
 **/
@RestController
@RequiredArgsConstructor
@RequestMapping("/app/boss/setup")
public class AppBossSetupController {

    private final AppBossSetupService appBossSetupService;

    @PostMapping("/getColorSize")
    @Log("查询设置的颜色尺寸")
    public WebResponse getColorAndSize() {
        return appBossSetupService.getColorAndSize();
    }

    @PostMapping("/edit")
    @Log("更新设置信息")
    public WebResponse editSetUp(@RequestBody BossSetupBo resources) {
        ParamsValid valid = new ParamsValid();
        if (!valid.isValid()) {
            return WebResponseUtils.errorParam(valid.getMsg());
        }
        return appBossSetupService.editSetUp(resources);
    }

    @GetMapping("/get")
    @Log("获取设置信息")
    public WebResponse getSetUp() {
        return appBossSetupService.getSetUp();
    }

}